#ifndef __MYSTRING_H__
#define __MYSTRING_H__
#define true 1
#define false 0

typedef struct string mystring;

struct string
{
    char *string;
    int size;
    int cubage;

    void (*print)(mystring *obj);
    int (*size1)(mystring *obj);
    int (*isstringequal)(mystring *obj1,mystring *obj2);
    int (*iscontains)(mystring *obj1,mystring *obj2);
    char* (*atindex)(mystring *obj,int index);
    void (*removestring)(mystring *obj,const char *p);
    int (*insertstring)(mystring *obj1,const char *p,int index);
    int (*toint)(mystring *obj);
    double(*todouble)(mystring *obj);
    void (*freestring)(mystring *obj);
    int (*reallocarray)(mystring  *obj);
};

int InitString(mystring *obj, const char *str);//字符串初始化
void Print(mystring *obj);//打印字符串及其容量和长度
int Size1(mystring *obj);//返回字符串长度
int IsStringEqual(mystring *obj1,mystring *obj2);//判断2个字符串是否相等
int IsContains(mystring *obj1,mystring *obj2);//判断字符串2是否是字符串1的子串
char* AtIndex(mystring *obj,int index);//按位置查找字符串中匹配的字符
void RemoveString(mystring *obj,const char *p);//按字符删除字符串中匹配的字符
int InsertString(mystring *obj1,const char *p,int index);//按位置插入字符串
int ToInt(mystring *obj);//字符串数字转int
double ToDouble (mystring *obj);//字符串数字转double
void FreeString(mystring *obj);//字符串内存释放
int ReallocArray(mystring  *obj);//字符串的扩容

#endif